import { lazy } from 'react';

import type { RouteObject } from 'react-router-dom';
type RouteItem = RouteObject & {
  name: string;
  title: string;
};
const Login = lazy(() => import('@/views/Login/Login'));
const Register = lazy(() => import('@/views/Register/Register'));
const UpdatePassword = lazy(() => import('@/views/UpdatePassword/UpdatePassword'));
const ErrorPage = lazy(() => import('@/views/error/ErrorPage'));
const Home = lazy(() => import('@/views/Home/Home'));
const UpdateUserInfo = lazy(() => import('@/views/UpdateUserInfo/UpdateUserInfo'));
const User = lazy(() => import('@/views/system/user/index'));
const Room = lazy(() => import('@/views/system/room/index'));
const routes: RouteItem[] = [
  {
    path: '/',
    name: 'home',
    Component: Home,
    title: '首页',
    children: [
      {
        path: '/room',
        Component: Room,
      },
      {
        path: '/user',
        Component: User,
      },
    ],
  },
  {
    path: '/login',
    name: 'login',
    Component: Login,
    title: '登录',
  },
  {
    path: '/register',
    name: 'register',
    Component: Register,
    title: '注册',
  },
  {
    path: '/update-password',
    name: 'updatePassword',
    Component: UpdatePassword,
    title: '修改密码',
  },
  {
    path: '/update-userinfo',
    name: 'updateuserinfo',
    Component: UpdateUserInfo,
    title: '修改用户信息',
  },
  {
    path: '/404',
    name: '404',
    Component: ErrorPage,
    title: '404',
  },
];

export default routes;
